<template>
	<view class="min-max-close" v-if="show">
		<view class="min" @click="clickMin()" v-if="!noShowMin">
			<image src="../static/images/min.png" mode="aspectFill"></image>
		</view>
		<view class="max" @click="changeMax" v-if="!onShowMax">
			<image src="../static/images/reduction.png" mode="aspectFill" v-if="isMax"></image>
			<image src="../static/images/max.png" mode="aspectFill" v-else></image>
		</view>
		<view class="close" @click="closeFun">
			<!-- 该空盒子是关闭按钮的图片容器 -->
			<view></view>
		</view>
	</view>
</template>

<script>
	import windBtnContrl from "../js/WinBtnContrl.js";
	import minMaxCloseCtrl from "../js/com/MinMaxCloseBtnCtrl.js";
	export default {
		props:["noShowMin","onShowMax"],
		data() {
			return {
				isMax : false,
				show : true,
			};
		},
		created() {
			this.show = this.showRTBtns;
		},
		
		methods: {
			/*** 点击最大化与还原按钮来回切换 ***/
			changeMax()
			{
				this.isMax = !this.isMax;
				minMaxCloseCtrl.setIsMax(this.isMax);
				windBtnContrl.reduct();
			},
			
			/*** 点击最小化按钮 ***/
			clickMin()
			{
				windBtnContrl.min();
			},
			
			/*** 点击关闭按钮 ***/
			closeFun()
			{
				windBtnContrl.close();
			}
		},
		
		mounted() {
			this.isMax = minMaxCloseCtrl.getIsMax();
		}
	}
</script>
<style lang="scss">
	.min-max-close
	{
		position: absolute;
		right: 0px;
		top: -5px;
		z-index: 100;
		height: 40px;
		display: flex;
		align-items: center;
		view
		{
			width: 40px;
			height: 30px;
			display: flex;
			align-items: center;
			justify-content: center;
			image
			{
				width: 12px;
				height: 12px;
			}
		}
		.close
		{
			display: flex;
			align-items: center;
			justify-content: center;
			view
			{
				width: 16px;
				height: 16px;
				background: url(../static/images/close.png);
			}
		}
		view:hover
		{
			background: rgba(200,200,200,.4);
		}
		.close:hover
		{
			background: rgba(253, 0, 4, .8);
			view
			{
				background: url(../static/images/close_active.png);
			}
		}
	}
</style>